function [p durs]=openPump(p)

closeAllSerials;

ensurePumpStopped(p);

mlDefaultVolume=.5;

pumpProgram = ...
    {'*RESET' ...
    'VER' ...
    sprintf('DIA %.4g ',p.mmDiameter) ...
    'PHN 1' ...
    'FUN RAT' ...
    sprintf('RAT %d MH',p.mlPerHour) ...
    sprintf('VOL %.4g',p.volumeScaler*mlDefaultVolume) ...
    'DIR INF' ...
    'PHN 2' ...
    'FUN STP' ...
    'PHN 3' ...
    'FUN RAT' ...
    sprintf('RAT %d MH',p.mlPerHour) ...
    sprintf('VOL %.4g',p.volumeScaler*mlDefaultVolume) ...
    'DIR WDR' ...
    'PHN 4' ...
    'FUN STP' ...
    'CLD INF' ...
    'CLD WDR' ...
    'DIS' ...
    'PHN 1' ...
    'VOL' ...
    'PHN 3' ...
    'VOL' ...
    'ROM' ...
    'AL'};

p.serialPort = serial(p.serialPortAddress,'BaudRate',19200,'Terminator',{3,'CR'},'Timeout',1.0);
fprintf('opening pump serial connection\n');

if ~p.pumpOpen
    try
        fopen(p.serialPort);
        p.pumpOpen=1;
        [p durs]=sendCommands(p,pumpProgram);
    catch ex
        fprintf('closing serial port due to error\n');
        fclose(p.serialPort);
        rethrow(ex)
    end
else
    error('pump already open')
end